﻿<%@ Page Title="Ultimate Vacation Experience CMS :: Bookings" Language="C#" MasterPageFile="~/Admin/Admin.Master" AutoEventWireup="true" CodeBehind="Booking.aspx.cs" Inherits="TravelSite.Admin.Bookings.BookingPage" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
    <script type="text/javascript">
        $(function () {
            $.datepicker.setDefaults($.datepicker.regional[""]);

            $("#<%= txtFromDateFilter.ClientID %>").datepicker($.datepicker.regional["en-GB"]);
            $("#<%= txtFromDateFilter.ClientID %>").datepicker({
                showmonth: true,
                autoSize: true,
                showAnim: 'slideDown',
                duration: 'fast'
            });
            $("#<%= btnShowFromDateFilter.ClientID %>").click(function () {
                $("#<%= txtFromDateFilter.ClientID %>").datepicker('show');
            });

            $("#<%= txtToDateFilter.ClientID %>").datepicker($.datepicker.regional["en-GB"]);
            $("#<%= txtToDateFilter.ClientID %>").datepicker({
                showmonth: true,
                autoSize: true,
                showAnim: 'slideDown',
                duration: 'fast'
            });
            $("#<%= btnShowToDateFilter.ClientID %>").click(function () {
                $("#<%= txtToDateFilter.ClientID %>").datepicker('show');
            });

            Sys.WebForms.PageRequestManager.getInstance().add_pageLoaded(function (evt, args) {
                $(".search_input").on('keyup', function () {
                    __doPostBack('<%= upMain.ClientID %>', '');
                });
            });
        });

        function SetGridDateEdit(textId, buttonId) {
            $("#" + textId).datepicker($.datepicker.regional["en-GB"]);
            $("#" + textId).datepicker({
                showmonth: true,
                autoSize: true,
                showAnim: 'slideDown',
                duration: 'fast'
            });
            $("#" + buttonId).click(function () {
                $("#" + textId).datepicker('show');
            });
        }
    </script>
    <style type="text/css">
        .action_link
        {
            margin-right: 5px;
        }
        
        .sort_button
        {
            color: #ffffff;
            margin-right: 5px;
        }
    </style>

</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    
            <div class="page_header">
                <h2><img src="<%=ResolveClientUrl("~") %>images/design/dashboard_icon.png" alt="" title="" /> Bookings</h2>
            </div>

            <div class="search_panel">
                <div class="row">        
                    <div class="col-lg-2">
                        <label class="control-label" for="ddlDateFieldFilter">Date Column</label>
                        <asp:DropDownList CssClass="form-control" ID="ddlDateFieldFilter" runat="server">
                            <asp:ListItem Value="HotelbedsBookedDate">Date Booked</asp:ListItem>
                            <asp:ListItem Value="HotelbedsArrivalDate">Arrival Date</asp:ListItem>
                            <asp:ListItem Value="HotelbedsDepartureDate">Departure Date</asp:ListItem>
                            <asp:ListItem Value="HotelbedsPaymentDate">Payment Date</asp:ListItem>
                            <asp:ListItem Value="HotelbedsExpoPaidDate">Date YVD Paid to Expo</asp:ListItem>
                            <asp:ListItem Value="HotelbedsHBPaidDate">Date Expo Paid HB</asp:ListItem>
                        </asp:DropDownList>
                    </div>
                    <div class="col-lg-2">
                    	<div class="form-group">
                            <label class="control-label" for="txtFromDateFilter">Date From</label>
                            <div class="input-group">
                                <asp:TextBox runat="server" ID="txtFromDateFilter" CssClass="form-control" placeholder="Date From"/>
                                <span class="input-group-btn">
                                    <button runat="server" class="btn btn-default" type="button" id="btnShowFromDateFilter">
                                        <img src="<%=ResolveClientUrl("~") %>images/calander_icon.png" alt="calander" title="Calander" />
                                    </button>
                                </span>
                            </div> 
                        </div>
                    </div>
                    <div class="col-lg-2">
                    	<div class="form-group">
                            <label class="control-label" for="txtToDateFilter">Date To</label>
                            <div class="input-group">
                                <asp:TextBox runat="server" ID="txtToDateFilter" CssClass="form-control" placeholder="Date To"/>
                                <span class="input-group-btn">
                                    <button runat="server" class="btn btn-default" type="button" id="btnShowToDateFilter">
                                        <img src="<%=ResolveClientUrl("~") %>images/calander_icon.png" alt="calander" title="Calander" />
                                    </button>
                                </span>
                            </div> 
                        </div>
                    </div>

                    <div class="col-lg-2">                    	
                    	<asp:Button CssClass="btn btn-primary search_btn" ID="btnSearch" Text="Filter" runat="server" onclick="btnSearch_Click" />
                    </div>
                    <div class="col-lg-1" style="float:right">
                        <label class="control-label" for="ddlPageSizeFilter">Page Size</label>
                        <asp:DropDownList CssClass="form-control" ID="ddlPageSizeFilter" runat="server" AutoPostBack="true" OnSelectedIndexChanged="ddlPageSizeFilter_SelectedIndexChanged"/>
                    </div>
                    
                </div>
            </div>
            
            <asp:UpdatePanel ID="upMain" runat="server" UpdateMode="Conditional">
            <ContentTemplate>
            
        	<div class="page_container">
                <asp:ImageButton ID="btnExcelExport" runat="server" ImageUrl="~/images/excel-icon.png" ToolTip="Export To Excel" OnClick="btnExcelExport_Click" Height="24" Width="24" />
                <div class="table-responsive" style="overflow-x:auto;width:100%;">
                <asp:GridView ID="grid" AutoGenerateColumns="false" runat="server" CssClass="table table-bordered table-hover" 
                AllowPaging="True" PageSize="20" DataKeyNames="ContactId"
                AllowSorting="true" OnSorting="grid_Sorting" OnRowCreated="grid_RowCreated" 
                OnPageIndexChanging="grid_PageIndexChanging" onrowdatabound="grid_RowDataBound"
                OnRowCancelingEdit="grid_RowCancelingEdit" OnRowEditing="grid_RowEditing" OnRowUpdating="grid_RowUpdating" OnRowCommand="grid_RowCommand">
                <PagerSettings Mode="Numeric" PageButtonCount="4" NextPageText=">" PreviousPageText="<"  FirstPageText="<<" LastPageText=">>"/>
                <Columns>
                    <asp:TemplateField HeaderText="Action"> 
                        <ItemTemplate> 
                            <asp:ImageButton runat="server" ImageUrl="~/images/design/actions_icon/edit_icon.png" ToolTip="Edit" CssClass="action_link" CausesValidation="False" CommandName="Edit" />
                        </ItemTemplate> 
                        <EditItemTemplate> 
                            <asp:ImageButton runat="server" ImageUrl="~/images/design/actions_icon/check_icon.png" ToolTip="Update" CssClass="action_link" CausesValidation="True" CommandName="Update" />
                            <asp:ImageButton runat="server" ImageUrl="~/images/design/actions_icon/cancel_icon.png" ToolTip="Cancel" CssClass="action_link" CausesValidation="False" CommandName="Cancel" />
                        </EditItemTemplate> 
                    </asp:TemplateField> 

                    <asp:TemplateField HeaderText="Client" HeaderStyle-Width="200"> 
                        <HeaderTemplate>
						    <asp:Label runat="server" ID="lblFullNameHeader" data-field="FullName" Text="Client"/>
                            <asp:TextBox ID="tbFullNameHeader" EnableViewState="True" data-field="FullName" OnTextChanged="Filter_TextChanged" runat="server" Text="" CssClass="search_input form-control" placeholder=""></asp:TextBox>
						</HeaderTemplate> 
                        <ItemTemplate> 
                            <asp:Label ID="lblFullName" runat="server" Text='<%# Bind("FullName") %>'></asp:Label> 
                        </ItemTemplate> 
                        <EditItemTemplate> 
                            <asp:Label ID="lblFullName" runat="server" Text='<%# Bind("FullName") %>'></asp:Label> 
                        </EditItemTemplate> 
                    </asp:TemplateField> 

                    <asp:TemplateField HeaderText="Wholesaler" HeaderStyle-Width="200"> 
                        <HeaderTemplate>
						    <asp:Label runat="server" ID="lblWholesalerNameHeader" data-field="WholesalerName" Text="Wholesaler"/>
                            <asp:TextBox ID="tbWholesalerNameHeader" EnableViewState="True" data-field="WholesalerName" OnTextChanged="Filter_TextChanged" runat="server" Text="" CssClass="search_input form-control" placeholder=""></asp:TextBox>
						</HeaderTemplate> 
                        <ItemTemplate> 
                            <asp:Label ID="lblWholesaler" runat="server" Text='<%# Bind("WholesalerName") %>'></asp:Label> 
                        </ItemTemplate> 
                        <EditItemTemplate> 
                            <asp:DropDownList ID="ddlWholesaler" runat="server" DataTextField="WholesalerName" DataValueField="WholesalerId" CssClass="form-control"/>
                        </EditItemTemplate> 
                    </asp:TemplateField> 

                    <asp:TemplateField HeaderText="Invoice #" HeaderStyle-Width="200"> 
                        <HeaderTemplate>
						    <asp:Label runat="server" ID="lblHotelbedsInvoiceNumberHeader" data-field="HotelbedsInvoiceNumber" Text="Invoice #"/>
                            <asp:TextBox ID="tbHotelbedsInvoiceNumberHeader" EnableViewState="True" data-field="HotelbedsInvoiceNumber" OnTextChanged="Filter_TextChanged" runat="server" Text="" CssClass="search_input form-control" placeholder=""></asp:TextBox>
						</HeaderTemplate> 
                        <ItemTemplate> 
                            <asp:Label ID="lblHotelbedsInvoiceNumber" runat="server" Text='<%# Bind("HotelbedsInvoiceNumber") %>'></asp:Label> 
                        </ItemTemplate> 
                        <EditItemTemplate>
                            <asp:TextBox ID="txtHotelbedsInvoiceNumber" runat="server" Text='<%# Bind("HotelbedsInvoiceNumber") %>' placeholder="Invoice #" CssClass="form-control"></asp:TextBox> 
                        </EditItemTemplate> 
                    </asp:TemplateField> 

                    <asp:TemplateField HeaderText="Res #" HeaderStyle-Width="200"> 
                        <HeaderTemplate>
						    <asp:Label runat="server" ID="lblHotelbedsResNumberHeader" data-field="HotelbedsResNumber" Text="Res #"/>
                            <asp:TextBox ID="tbHotelbedsResNumberHeader" EnableViewState="True" data-field="HotelbedsResNumber" OnTextChanged="Filter_TextChanged" runat="server" Text="" CssClass="search_input form-control" placeholder=""></asp:TextBox>
						</HeaderTemplate> 
                        <ItemTemplate> 
                            <asp:Label ID="lblHotelbedsResNumber" runat="server" Text='<%# Bind("HotelbedsResNumber") %>'></asp:Label> 
                        </ItemTemplate> 
                        <EditItemTemplate>
                            <asp:TextBox ID="txtHotelbedsResNumber" runat="server" Text='<%# Bind("HotelbedsResNumber") %>' placeholder="Res #" CssClass="form-control"></asp:TextBox> 
                        </EditItemTemplate> 
                    </asp:TemplateField> 
                    
                    <asp:TemplateField HeaderText="Date Booked" HeaderStyle-Width="150" SortExpression="HotelbedsBookedDate"> 
                        <ItemTemplate> 
                            <asp:Label ID="lblHotelbedsBookedDate" runat="server" Text=""></asp:Label> 
                        </ItemTemplate> 
                        <EditItemTemplate>
                            <div class="input-group">
                                <asp:TextBox ID="txtHotelbedsBookedDate" runat="server" Text="" placeholder="Date Booked" CssClass="form-control"></asp:TextBox> 
                                <span class="input-group-btn">
                                    <button runat="server" class="btn btn-default" type="button" id="btnShowHotelbedsBookedDate">
                                        <img src="<%=ResolveClientUrl("~") %>images/calander_icon.png" alt="calander" title="Calander" />
                                    </button>
                                </span>
                            </div> 
                        </EditItemTemplate> 
                    </asp:TemplateField> 

                    <asp:TemplateField HeaderText="Arrival Date" HeaderStyle-Width="150" SortExpression="HotelbedsArrivalDate"> 
                        <ItemTemplate> 
                            <asp:Label ID="lblHotelbedsArrivalDate" runat="server" Text=""></asp:Label> 
                        </ItemTemplate> 
                        <EditItemTemplate>
                            <div class="input-group">
                                <asp:TextBox ID="txtHotelbedsArrivalDate" runat="server" Text="" placeholder="Arrival Date" CssClass="form-control"></asp:TextBox> 
                                <span class="input-group-btn">
                                    <button runat="server" class="btn btn-default" type="button" id="btnShowHotelbedsArrivalDate">
                                        <img src="<%=ResolveClientUrl("~") %>images/calander_icon.png" alt="calander" title="Calander" />
                                    </button>
                                </span>
                            </div> 
                        </EditItemTemplate> 
                    </asp:TemplateField> 

                    <asp:TemplateField HeaderText="Departure Date" HeaderStyle-Width="150" SortExpression="HotelbedsDepartureDate"> 
                        <ItemTemplate> 
                            <asp:Label ID="lblHotelbedsDepartureDate" runat="server" Text=""></asp:Label> 
                        </ItemTemplate> 
                        <EditItemTemplate>
                            <div class="input-group">
                                <asp:TextBox ID="txtHotelbedsDepartureDate" runat="server" Text="" placeholder="Departure Date" CssClass="form-control"></asp:TextBox> 
                                <span class="input-group-btn">
                                    <button runat="server" class="btn btn-default" type="button" id="btnShowHotelbedsDepartureDate">
                                        <img src="<%=ResolveClientUrl("~") %>images/calander_icon.png" alt="calander" title="Calander" />
                                    </button>
                                </span>
                            </div> 
                        </EditItemTemplate> 
                    </asp:TemplateField> 

                    <asp:TemplateField HeaderText="Payment Date" HeaderStyle-Width="150" SortExpression="HotelbedsPaymentDate"> 
                        <ItemTemplate> 
                            <asp:Label ID="lblHotelbedsPaymentDate" runat="server" Text=""></asp:Label> 
                        </ItemTemplate> 
                        <EditItemTemplate>
                            <div class="input-group">
                                <asp:TextBox ID="txtHotelbedsPaymentDate" runat="server" Text="" placeholder="Payment Date" CssClass="form-control"></asp:TextBox> 
                                <span class="input-group-btn">
                                    <button runat="server" class="btn btn-default" type="button" id="btnShowHotelbedsPaymentDate">
                                        <img src="<%=ResolveClientUrl("~") %>images/calander_icon.png" alt="calander" title="Calander" />
                                    </button>
                                </span>
                            </div> 
                        </EditItemTemplate> 
                    </asp:TemplateField> 

                    <asp:TemplateField HeaderText="Vacation Company" HeaderStyle-Width="200"> 
                        <HeaderTemplate>
						    <asp:Label runat="server" ID="lblVacationCompanyNameHeader" data-field="VacationCompanyName" Text="Vacation Company"/>
                            <asp:TextBox ID="tbVacationCompanyNameHeader" EnableViewState="True" data-field="VacationCompanyName" OnTextChanged="Filter_TextChanged" runat="server" Text="" CssClass="search_input form-control" placeholder=""></asp:TextBox>
						</HeaderTemplate> 
                        <ItemTemplate> 
                            <asp:Label ID="lblBankInfoVacationCompany" runat="server" Text='<%# Bind("VacationCompanyName") %>'></asp:Label> 
                        </ItemTemplate> 
                        <EditItemTemplate> 
                            <asp:DropDownList ID="ddlBankInfoVacationCompany" runat="server" DataTextField="VacationCompanyName" DataValueField="VacationCompanyId" CssClass="form-control"/>
                        </EditItemTemplate> 
                    </asp:TemplateField> 

                    <asp:TemplateField HeaderText="Total Wholesale Cost" ItemStyle-HorizontalAlign="Right"> 
                        <ItemTemplate> 
                            <asp:Label ID="lblHotelbedsTotalWholesaleCost" runat="server" Text=""></asp:Label> 
                        </ItemTemplate> 
                        <EditItemTemplate> 
                            <asp:TextBox ID="txtHotelbedsTotalWholesaleCost" runat="server" Text="" placeholder="Total Wholesale Cost" CssClass="form-control"></asp:TextBox> 
                        </EditItemTemplate> 
                    </asp:TemplateField> 
                    
                    <asp:TemplateField HeaderText="Date YVD Paid to Expo" HeaderStyle-Width="120" SortExpression="HotelbedsExpoPaidDate"> 
                        <ItemTemplate> 
                            <asp:Label ID="lblHotelbedsExpoPaidDate" runat="server" Text=""></asp:Label> 
                        </ItemTemplate> 
                        <EditItemTemplate>
                            <div class="input-group">
                                <asp:TextBox ID="txtHotelbedsExpoPaidDate" runat="server" Text="" placeholder="Date YVD Paid to Expo" CssClass="form-control"></asp:TextBox> 
                                <span class="input-group-btn">
                                    <button runat="server" class="btn btn-default" type="button" id="btnShowHotelbedsExpoPaidDate">
                                        <img src="<%=ResolveClientUrl("~") %>images/calander_icon.png" alt="calander" title="Calander" />
                                    </button>
                                </span>
                            </div> 
                        </EditItemTemplate> 
                    </asp:TemplateField> 

                    <asp:TemplateField HeaderText="Total Paid" ItemStyle-HorizontalAlign="Right"> 
                        <ItemTemplate> 
                            <asp:Label ID="lblHotelbedsTotalPaid" runat="server" Text=""></asp:Label> 
                        </ItemTemplate> 
                        <EditItemTemplate> 
                            <asp:TextBox ID="txtHotelbedsTotalPaid" runat="server" Text="" placeholder="Total Paid" CssClass="form-control"></asp:TextBox> 
                        </EditItemTemplate> 
                    </asp:TemplateField> 

                    <asp:TemplateField HeaderText="Check #"> 
                        <HeaderTemplate>
						    <asp:Label runat="server" ID="lblHotelbedsCheckNumberHeader" data-field="HotelbedsCheckNumber" Text="Check #"/>
                            <asp:TextBox ID="tbHotelbedsCheckNumberHeader" EnableViewState="True" data-field="HotelbedsCheckNumber" OnTextChanged="Filter_TextChanged" runat="server" Text="" CssClass="search_input form-control" placeholder=""></asp:TextBox>
						</HeaderTemplate> 
                        <ItemTemplate> 
                            <asp:Label ID="lblHotelbedsCheckNumber" runat="server" Text='<%# Bind("HotelbedsCheckNumber") %>'></asp:Label> 
                        </ItemTemplate> 
                        <EditItemTemplate>
                            <asp:TextBox ID="txtHotelbedsCheckNumber" runat="server" Text='<%# Bind("HotelbedsCheckNumber") %>' placeholder="Check #" CssClass="form-control"></asp:TextBox> 
                        </EditItemTemplate> 
                    </asp:TemplateField> 

                    <asp:TemplateField HeaderText="Date Expo Paid HB" HeaderStyle-Width="120" SortExpression="HotelbedsHBPaidDate"> 
                        <ItemTemplate> 
                            <asp:Label ID="lblHotelbedsHBPaidDate" runat="server" Text=""></asp:Label> 
                        </ItemTemplate> 
                        <EditItemTemplate>
                            <div class="input-group">
                                <asp:TextBox ID="txtHotelbedsHBPaidDate" runat="server" Text="" placeholder="Date Expo Paid HB" CssClass="form-control"></asp:TextBox> 
                                <span class="input-group-btn">
                                    <button runat="server" class="btn btn-default" type="button" id="btnShowHotelbedsHBPaidDate">
                                        <img src="<%=ResolveClientUrl("~") %>images/calander_icon.png" alt="calander" title="Calander" />
                                    </button>
                                </span>
                            </div> 
                        </EditItemTemplate> 
                    </asp:TemplateField> 
                    
                </Columns>
                </asp:GridView>
                </div>
            </div>

            </ContentTemplate>
                <Triggers>
                    <asp:PostBackTrigger ControlID="btnExcelExport" />
                </Triggers>
            </asp:UpdatePanel>
</asp:Content>
